Skip to content

A missing plan decision is a planner failure, never a question; new work phrased as a complaint is a feature - #491

Merged
nambok merged 1 commit into
mainfrom
fix/fix-location-format-failure
Nov 6, 2026
Merged

nambok merged 1 commit into
mainfrom
fix/fix-location-format-failure

Conversation

@nambok

@nambok nambok commented Nov 6, 2026

Copy link
Copy Markdown
Collaborator

Summary

A run on a new-feature ticket (a complaint followed by "add a setting ...", part 4 of 4 in a series) planned for 7 minutes and 2.1M tokens, then stopped with "Not sure yet where the fix belongs" and asked "Where does the fix belong: which system or part of it?". Root cause, in order:

  1. The planner's decision block was lost, and that was routed as a question. The block is the last thing the planner writes (plan.rs prompt ends with "Then the ```fix_location.json block"), after up to 25 tool turns plus send-backs, under max_tokens: 16384 (`plan.rs` `plan_opts`). An answer that stops at the output limit is returned as final with no check (`agent/anthropic.rs`, `tool_uses.is_empty()` branch), so the block is cut or missing. `fix_location::parse` turns that into `None`; `gaps()` returns nothing for `None`, so no send-back covers it; `route(None)` is `Route::Ask`.
  2. fix_location::undecided() always carried TicketIntent::Bug (..Default::default()), so a missing block printed the bug title and the bug question whatever triage decided. The bug wording alone does not prove triage misread the ticket.
  3. Triage's bug definition included "missing ... for its users" and any unknown model word (enhancement) read as a bug, so "editors can't choose X: add an X setting" could also be read as a bug. No tracker type reached the worker.
  4. Nothing checked the shape of a question to a person, so an open "where does it belong" with no options was asked.
  5. Series siblings were invisible: earlier-attempt search only matches the same ticket, keys named in the text, or titles at least 60% alike.

Changes

  • Missing or malformed decision = format failure (fix_location.rs, plan.rs): parse_detailed says whether the block is missing, cut off or malformed. The planner is asked once more for only the block (fresh small call, no tools, 4096 tokens, low effort, given the plan it wrote). If there is still no block, fallback decides from the plan: feature or chore work, or tasks naming this repo's files, is code; NO_CODE_CHANGE: stays unknown with its own line; nothing to decide from fails the run as a planner failure. Reused plans with no decision go through the same fallback (mod.rs), and a missing decision no longer counts as a directive that skips the malformed-plan guard.
  • Planner failure in run data and analytics: planner_failure, planner_failure_kind and planner_failure_tokens on the run, ADD planner_format_failures on the monthly and ALL_TIME analytics rows, FixDecision.planner_failure, and a progress note.
  • Intent (triage.rs, common/messages.rs, gateway, Forge app): TicketMessage.ticket_type carries the Jira issue type (fields.issuetype.name) or the GitHub issue type or kind label. settle_intent combines the model's read with that type and the ticket's words (new-work verb plus a thing to build in the title, or acceptance criteria like "can choose ..."). It never applies when the title names a defect. The prompt now says a ticket asking to add a setting, option, field, page or capability is a feature even when phrased as a complaint, and enhancement, improvement and story parse as feature.
  • Question shape (common/run_questions.rs, stop_rules/screen.rs, fix_location::person_questions): too_open holds back an open "where does it belong" or "what else" question that has no options and no recommendation. It is part of the asking rules. When the run stops, its fallback question is built from what it found: the next step and its outcomes, the outside change, "I plan to change ; go ahead?", or the no-code line. Each comes with options.
  • Series (series.rs, plan.rs): for a ticket marked "part N of M", the planner prompt lists the other parts' pull requests in the repo (same series length with a different part, or a nearby key of the same project, sharing the series' words) and tells the planner to build on them.
  • Output limit: the model loop warns when a final answer stops at max_tokens.
  • PLANNER_VERSION bumped.

Verification

  • cargo fmt --all --check, cargo clippy -p worker -p common -p gateway --all-targets -- -D warnings, cargo test -p worker -p common -p gateway: all pass (worker 1303, common 1453, gateway 739). Forge app node --test: 9 of 9 pass.
  • New tests:
    • The live case: a feature phrased as a complaint with no block proceeds to code and Route::Code without asking, even when read as a bug.
    • A real bug whose fault is outside the code still routes OutsideOnly, and when it is unsure it asks the concrete next step with its outcomes.
    • Blocks that are missing, cut off or malformed each report which; the re-ask prompt is small and its reply parses.
    • Question shape: open questions are held back, while questions with options, a recommendation or a specific yes/no are kept, and the built fallback question always passes.
    • Intent from varied phrasings in both directions, and the tracker type in both directions.
    • Series marker forms and sibling matching.
  • Not verified live: the Forge change (sending issuetype) takes effect only with the next Forge deploy. Until then, Jira tickets coming through Forge rely on the text signals. Site webhooks already include issuetype. The worker has no Jira read API, so it reads sibling tickets' pull requests, not the tickets themselves. The dashboard does not show planner_format_failures yet.

…ork phrased as a complaint is a feature

- A plan with no readable fix_location block (missing, cut off at the
  output limit, or malformed) re-asks the planner once for just the block
  (one small call, no tools), then decides from the plan itself: new work
  or a plan whose tasks name this repo's files is code. A plan with nothing
  to decide from fails as a planner failure. Recorded on the run and in
  analytics (planner_format_failures), never asked of a person.
- Triage settles intent with the tracker's own type (Jira issue type,
  GitHub issue type or kind label, now carried on the ticket) and the
  ticket's words: asking to add a setting, option, field, page or
  capability is a feature even when phrased as a complaint.
- Questions to a person must name options or a recommendation: an open
  "where does the fix belong" is held back by the asking rules, and the
  fallback question is built from what the run found.
- A ticket that is part N of M reads the other parts' pull requests
  before planning.
- The model loop warns when a final answer stops at the output limit.
@nambok
nambok force-pushed the fix/fix-location-format-failure branch from 5dfc754 to ed2f2dc Compare November 6, 2026 14:53
@nambok
nambok merged commit c75f48d into main Nov 6, 2026
10 checks passed
@nambok
nambok deleted the fix/fix-location-format-failure branch November 6, 2026 14:58
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant